package cn.com.dhcc.app.pub.core.consts;

import org.apache.log4j.Logger;

import cn.com.dhcc.app.core.handler.propertyhandler.CommentedProperties;
import cn.com.dhcc.app.core.service.Log;
import cn.com.dhcc.app.core.service.Log.LOGTYPE;
import cn.com.dhcc.app.core.util.PropertiesUtil;
/**
 * 内核相关参数
 * @author qiao
 * @2015-2-5 @下午4:01:32
 */
public class KernelParam {
	
	private static CommentedProperties kernelProperties = null;
	static Logger logger = Log.getLogger(LOGTYPE.SYS);
	static{
		try {
			kernelProperties =  PropertiesUtil.loadProperties("kernel.properties");
		} catch (Exception e) {
			logger.error("初始化内核参数失败...",e);
		}
	}
/*
	#压缩相关参数
	#是否启动压缩
	compress.enable=true
	#压缩文件的上限 50MB，操作此值不压缩
	compress.maxSize=50
	#能被压缩的文件后缀
	compress.file.sudfix=txt|pdf|doc|docx|xls|bmp|log|wps|java|jsp|sql|dmp|html|htm
	#内外网交换是否启动压缩
	compress.crossnet.enable=true
	#内外网交换单个文件最大限制
	compress.crossnet.maxsize=200M
	#加密
	#ftp是否开启ssl
	encrypt.ftp.usessl=true
	#消息队列是否开启ssl
	encrypt.q.usessl=true
	#是否加密存储
	encrypt.store.enable=false
	#内外网交换是否加密
	encrypt.crossnet.enable=false*/
	public static final boolean compressEnable = PropertiesUtil.getPara(kernelProperties,Boolean.class,"compress.enable", true);
	public static final Integer compressMaxSize = PropertiesUtil.getPara(kernelProperties,Integer.class,"compress.maxSize", 50);
	public static final String compressFileSudfix = PropertiesUtil.getPara(kernelProperties,String.class,"compress.file.sudfix", "");
	public static final boolean compressCrossnetEnable = PropertiesUtil.getPara(kernelProperties,Boolean.class,"compress.crossnet.enable", true);
	public static final Integer compressCrossnetMaxsize = PropertiesUtil.getPara(kernelProperties,Integer.class,"compress.crossnet.maxsize", 200);
	
	//
	public static final boolean encryptFtpUsessl = PropertiesUtil.getPara(kernelProperties,Boolean.class,"encrypt.ftp.usessl", true);
	public static final String encryptFtpSslStorepass = PropertiesUtil.getPara(kernelProperties,String.class,"encrypt.ftp.ssl.storepass", "");
	public static final String encryptFtpSslKeypass = PropertiesUtil.getPara(kernelProperties,String.class,"encrypt.ftp.ssl.keypass", "");
	
	public static final boolean encryptQusessl = PropertiesUtil.getPara(kernelProperties,Boolean.class,"encrypt.q.usessl", true);
	public static final boolean encryptStoreEnable = PropertiesUtil.getPara(kernelProperties,Boolean.class,"encrypt.store.enable", true);
	public static final boolean encryptCrossnetEnable = PropertiesUtil.getPara(kernelProperties,Boolean.class,"encrypt.crossnet.enable", true);
	public static final Integer encryptMaxSize = PropertiesUtil.getPara(kernelProperties,Integer.class,"encrypt.maxSize", 50);
	
	//授权码是否需要验证，1为true需要验证，0为false 不需要验证
	public static final boolean authValidate = !"0".equals(PropertiesUtil.getPara(kernelProperties,String.class,"authCode.validate.enabled", "1")) ? true:false;
	/*线程池
	threadpool.jsm-custom.xms=20
	初始化线程最大值
	threadpool.jsm-custom.xmx=50
	*/
	public static final Integer jmsThreadPoolMinSize = PropertiesUtil.getPara(kernelProperties,Integer.class,"threadpool.jsm-custom.xms", 20);
	public static final Integer jmsThreadPoolMaxSize = PropertiesUtil.getPara(kernelProperties,Integer.class,"threadpool.jsm-custom.xmx", 50);
	
	public static final Integer tlqTransportPipelineEnable = PropertiesUtil.getPara(kernelProperties,Integer.class,"tlq.transportPipeline.enable", 0);
	
	//结构化数据传输最大的
	   public static final int CMDATA_MAXSIZE = PropertiesUtil.getPara(kernelProperties,Integer.class,"server.cmdata.maxsize", 10485760);
}
